﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebApp.CompanyService;
using WebApp.DomainService;
using WebApp.ProductService;
using WebApp.TypeService;

namespace WebApp
{
    public partial class Cart : System.Web.UI.Page
    {
        ProductServiceClient ProductClient;
        TypeServiceClient TypeClient;
        DomainServiceClient DomainClient;
        CompanyServiceClient CompanyClient;
        protected void Page_Load(object sender, EventArgs e)
        {
            ProductClient = new ProductServiceClient();
            TypeClient = new TypeServiceClient();
            DomainClient = new DomainServiceClient();
            CompanyClient = new CompanyServiceClient();
           
            if (Request.QueryString.HasKeys())
            {
                ProductDTO item;
                ProductClient.SetID(Convert.ToInt32(Request.QueryString["ProductID"]));
                //ProductClient.SetID(Convert.ToInt32(Request.Params["ProductID"]));
                item = ProductClient.GetProductByID();
                imgCover.ImageUrl = item.Image;
                lblName.Text = item.ProductName;
                lblPrice.Text = item.Price.ToString();
                lblProPrice.Text = item.ProPrice.ToString();
                int a = item.TypeID;
                TypeClient.SetID(a);
                TypeDTO t = TypeClient.GetTypeByID();
                lblType.Text = t.TypeName;
                int b = item.DomainID;
                DomainClient.SetID(b);
                DomainDTO d = DomainClient.GetDomainByID();
                lblDomain.Text = d.DomainName;
                int c = item.CompanyID;
                CompanyClient.SetID(a);
                CompanyDTO p = CompanyClient.GetCompanyByID();
                lblCompany.Text = p.CompanyName;
                //lblCompany.Text = item.CompanyID.ToString();
                //lblDomain.Text = item.DomainID.ToString();
                //lblType.Text = item.TypeID.ToString();
                
            }
            
        }
    }
}